import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:lepig/model/BannerModel.dart';
import 'package:lepig/model/PageInfoModel.dart';
import 'package:lepig/model/ProductModel.dart';

import 'lib/EntityFactory.dart';
import 'lib/HttpManager.dart';
import 'lib/NWApi.dart';
import 'lib/NWMethod.dart';

Future<List<BannerModel>> HttpBanner(BuildContext context,{int viewPosition=1}) async {

  Map<String, dynamic> data = new Map<String, dynamic>();
  data["viewPosition"] =viewPosition.toString();

  Map responseBody = await HttpManager()
      .request(NWApi.selectBannerList, NWMethod.GET, params: data);
  List<dynamic> list = responseBody["data"];

  List<BannerModel> lists = new List<BannerModel>();
  list.forEach((element) {
    lists.add(BannerModel.fromJson(element) );
  });
  return lists;
}


